package com.sunfeng;

import java.nio.CharBuffer;

/**
 * @description:
 * @author: 孙 峰
 * @time: 2020/11/5 20:58
 */
public class Test3 {
    public static void main(String[] args) {
        char[] chars = new char[]{'a', 'b', 'c', 'd','e'};
        CharBuffer charBuffer = CharBuffer.wrap(chars);
        System.out.println("A capacity()="+charBuffer.capacity());
        System.out.println("A limit()="+charBuffer.limit());
        charBuffer.position(2);
        System.out.println("B capacity()="+charBuffer.capacity());
        System.out.println("B limit()="+charBuffer.limit());
        charBuffer.put('z');
        for (int i = 0; i < charBuffer.length(); i++) {
            System.out.println(chars[i]+" ");
        }
    }
}
